package com.hbsx.why.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.hbsx.why.model.bean.UserBean;
import com.hbsx.why.utils.LogUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by hugeterry(http://hugeterry.cn)
 * Date: 16/1/28 17:24
 */
public class SpacePagerAdapter extends FragmentPagerAdapter {
    private List<Fragment> mFragments = new ArrayList<>();
    private  List<UserBean> userBeanList;

    public SpacePagerAdapter(FragmentManager fm, List<Fragment> mFragments, List<UserBean> userBeanList) {
        super(fm);
        LogUtils.logi("----------MyPagerAdapter");
        this.mFragments = mFragments;
        this.userBeanList = userBeanList;
    }

    @Override
    public int getCount() {
        return mFragments.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return userBeanList.get(position).getName();
    }

    @Override
    public Fragment getItem(int position) {
        return mFragments.get(position);
    }
}
